package com.zxy.servlet;

import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;

import java.io.FileOutputStream;
import java.io.IOException;
@WebServlet("/servlet3")
public class Servlet3 extends HttpServlet {
    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
       ServletContext servletContext = getServletContext();

        //      向upload目录中写入一个文件
        String path = servletContext.getRealPath("upload");
        System.out.println(path);
    }
}
